package com.koron.order.defect.mapper;

import com.koron.order.defect.bean.dto.DefectEquipmentDto;
import com.koron.order.defect.bean.dto.SzlsDefectDto;
import com.koron.order.defect.bean.po.DefectBean;
import com.koron.order.defect.bean.po.DefectRate;
import com.koron.order.defect.bean.po.DefectSta;
import com.koron.order.defect.bean.query.DefectEquipmentQuery;
import com.koron.order.defect.bean.query.DefectQuery;
import com.koron.order.defect.bean.vo.DefectVO;
import com.koron.order.orderAsset.bean.OrderAsset;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @ClassName OrderMapper
 * @description
 * @Author zhouj
 * @Date 2021/9/1 11:26
 */
public interface DefectMapper {

    int insert(DefectBean defectBean);

    int update(DefectBean defectBean);

    int updateBatch(@Param("defectBeans") List<DefectBean> defectBeans);

    int delete(@Param("ids") List<String> list);

    DefectVO queryById(@Param("id")String id,@Param("language")String language);

    List<DefectBean> queryList(DefectVO defectVo);

    List<DefectVO> queryDefectVoList(@Param("query")DefectQuery query,@Param("language") String language);

    int submitDefect(@Param("orderId") String orderId, @Param("status") String status);

    List<DefectEquipmentDto> queryEquipmentDefectNums(@Param("defectEquipmentQueryList") List<DefectEquipmentQuery> defectEquipmentQueryList);

    List<DefectEquipmentDto> queryEquipmentDefectNumsByIds(@Param("list") List<List<String>> agreementNumberList);

    int deprecatedBatch(@Param("orderIds") List<String> ids_after, @Param("status") String status);

    // 数字孪生对外接口查询
    List<SzlsDefectDto> szlsDefectByYear(SzlsDefectDto dto);

    List<DefectRate> getRateOfDefect(@Param("startTime") String startTime,@Param("endTime") String endTime);

    List<DefectRate> getRateImmediateOfDefect(@Param("startTime") String startTime,@Param("endTime") String endTime);

    int updateInfo(@Param("param") Map<String,Object> param);

    @MapKey("id")
    List<Map<String,String>> getEquipmentByParentId(@Param("parentIds") List<String> parentIds);

    ArrayList<OrderAsset> selectDefectOrderAsset();

    List<DefectSta> staDefectByDept(@Param("startTime") String startTime, @Param("endTime") String endTime);

    List<DefectSta> staDefectByMajor(@Param("startTime") String startTime, @Param("endTime") String endTime);

    List<DefectSta> staDefectByLevel(@Param("startTime") String startTime, @Param("endTime") String endTime);

    List<DefectSta> staDefectBySource(@Param("startTime") String startTime, @Param("endTime") String endTime);

    int staDefectTotal(@Param("startTime") String startTime, @Param("endTime") String endTime);


    List<Map<String, Integer>> getDefectStock();
}
